@extends('home.index.layout')

@section('content')
<script src="{{url('/ho/js/event.js')}}"></script>
<link href="{{url('/ho/css/themes.css')}}" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ asset('/ad/bootstrap/css/font-awesome.min.css')}}">
<style type="text/css">
    input{
        width: 30%;
    }
</style>
<div class="wrap">
        <!--面包屑-->
        <div class="crumbs"><a class="ml0" href="{{url('/')}}">首页</a>&gt;<a href="{{url('/home/user/space')}}" class="j_ygnav">我的易果</a><span class="j_thridcrumbs">&gt;<a href="{{url('/user/address')}}" class="on j_thirdnav">地址管理</a></span></div>
    <div class="content myyg">
            <div class="sub">
                <div class="menu j_menu">
                    <dl>
                        <dt>交易信息</dt>
                        <dd>
                            <ul>
                                <li><a href="{{url('/order/index')}}">我的订单</a></li>
                                
                                <li><a href="">我的金币</a></li>
                                
                                
                                
                                <li><a href="">购买过的商品</a></li>
                                <li><a href="{{url('/user/favorite')}}">我的收藏</a></li>
                                <li><a href="">评论商品</a></li>
                            </ul>
                        </dd>
                        <dt>账号信息</dt>
                        <dd>
                            <ul>
                                <li><a href="">账户余额</a></li>
                                <li>
                                    <a href="{{url('/user/detail')}}">个人资料</a>
                                        <img style="height: 19px; width: 20px; margin-left: 10px;" src="{{url('/ho/imgs/icon-gift.png')}}">
                                </li>
                                <li><a href="">账号安全</a></li>
                                <li><a href="{{url('/user/address')}}">收货地址管理</a></li>
                            </ul>
                        </dd>
                        <dt>售后服务</dt>
                        <dd>
                            <ul>
                                <li><a href="">在线退换货</a></li>
                                <li><a href="">投诉建议</a></li>
                            </ul>
                        </dd>
                    </dl>
                </div>
                <div>
                    <div class="ad" style="height: 308px;">
                        <a href="#" target="_blank" style="display: none"><img src="{{url('/ho/imgs/ad.jpg')}}" width="194" height="308"></a>
                    </div>
                </div>
            </div>

<div class="main profile">
    <div class="title">收货地址</div>
    <div class="table">
    <link rel="stylesheet" href="{{ asset('/ad/bootstrap/css/bootstrap.min.css')}}">
        <table id="example1" class="table table-bordered table-striped">
            <thead>
            <tr>
                <th>ID</th>
                <th>收货人</th>
                <th>省</th>
                <th>市</th>
                <th>县</th>
                <th>详细地址</th>
                <th>手机号</th>
                <th>邮编</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            @foreach($data as $u)
            <tr>
                <td class="ids">{{$u -> id }}</td>
                <td class="order_num">{{$u -> rname }}</td>
                <td class="province">{{$u -> province }}</td>
                <td class="uname">{{$u -> city }}</td>
                <td class="district">{{$u -> district }}</td>
                <td class="address">{{$u -> address }}</td>
                <td class="mobie">{{$u -> mobie }}</td>
                <td class="post">{{$u -> post }}</td>
                <td><a   style="background-color: white;" href="{{url('/user/delAddress')}}/{{$u -> id}}"><c class="fa fa-fw fa-remove"></c></a></td>
            </tr>
            @endforeach
            </tbody>
        </table>
    </div>
    <br>
    <br>
    <br>
    <div class="title">添加新地址</div>
    <hr>
    <div style="width:300px;">
        <form action="{{url('/user/doAddress')}}" method="post" class="form-horizontal">
        {{csrf_field()}}
            收货人姓名：<input width='30%' class="form-control" type="text" name='rname'/><br>
            手机号：<input class="form-control" type="text" name='mobie'/>
            
            地址：<div class="info">
                <div>
                <select id="s_province" name="province"></select>  
                <select id="s_city" name="city" ></select>  
                <select id="s_county" name="district"></select>
                
                <script type="text/javascript">_init_area();</script>
                </div>
                <div id="show"></div>
            </div>
            详细地址：<input class="form-control" type="text" name='address'/>
            邮编：<input class="form-control" type="text" name='post'/>
            
            <br>
            <button style="background-color:#008842; width: 94px;height: 30px;color:white;">提交新地址</button>


        </form>
    </div>
</div>
<script type="text/javascript">
    $('#s_province').on('change',function(){
        console.log($(this).val())
    });
</script>


<link href="{{url('/ho/css/profile.css')}}" rel="stylesheet" type="text/css">



                </div>

            </div>
       
</div>
    </div>

</div>
@endsection
<script class="resources library" src="{{url('/ho/js/area.js')}}" type="text/javascript"></script>
<script type="text/javascript">
    var Gid  = document.getElementById ;
    var showArea = function(){
        Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +    
        Gid('s_city').value + " - 县/区" + 
        Gid('s_county').value + "</h3>"
                                }
    Gid('s_county').setAttribute('onchange','showArea()');

</script>